package kr.hkit.androidcomplete01.chapter08;

import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;

public class HandleEventListenerEx extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		View vw = new View(this);
		
		vw.setOnTouchListener(touchListener);
		setContentView(vw);
	}
	TouchListener touchListener = new TouchListener();
	class TouchListener implements View.OnTouchListener{

		@Override
		public boolean onTouch(View v, MotionEvent event) {
			if(event.getAction() == MotionEvent.ACTION_DOWN){
				Toast.makeText(HandleEventListenerEx.this, "Touch event Received", Toast.LENGTH_SHORT).show();
				return true;
			}
			return false;
		}
		
	}
}
